package com.bank.handler;


import com.bank.entity.constant.ResponseEnum;
import com.bank.entity.vo.Response;

import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
@Component
public class BankExceptionHandler {

    @ResponseBody
    @ExceptionHandler(Exception.class)
//    public Response handlerException(Exception e) {
//        Response response = new Response();
//        response.getCode(ResponseEnum.ERROR);
//        response.("出异常..." + e.getMessage());
//        e.printStackTrace();
//        return response;
//    }
    public Response exception(Exception e) {
        e.printStackTrace();
        return Response.response3(ResponseEnum.ERROR, "出异常..."+e.getMessage());
    }


}
